<?php
	//set le titre drupal
	drupal_set_title('');
	$url = $config->getVar('url');
	
	//ajoute le JS pour cette vue
	if (isset($userList))
	{
		$js = 'var userList = [';
		foreach($userList as $_user)
			$js.= '{text: "'.$_user['lastname'].' '.$_user['firstname'].' ('.$_user['email'].')", id: "'.$_user['id'].'"}, ';
		$js = substr($js,0, strlen($js)-2);
		$js.='];';
		drupal_add_js($js, 'inline');
	}
	
	drupal_add_js('bdbdec/view/scripts/jQueryAutocomplete.js');
	drupal_add_js('bdbdec/view/scripts/searchUser.js');
	
	//ajoute le CSS pour la vue
	drupal_add_css('bdbdec/view/css/autocomplete.css');
	drupal_add_css('bdbdec/view/css/searchUser.css');
	
	
			
echo '
<div id="tabs-wrapper" class="clear-block">
		<h2 class="with-tabs">Ajouter un utilisateur</h2>
		<ul class="tabs primary">
			<li>
				<a href="'.$url.'/bdbdec.php?action=addUser">Ajouter un utilisateur</a>
			</li>
			<li class="active">';
			if ($user->getGrade()->getType() == GRADE_TYPE_POWER && $user->isAllowedTo(GRADE_ADD_MEMBER))
				echo '<a class="active" href="'.$url.'/bdbdec.php?action=editUserPerm">Modifier un utilisateur</a>';
			else if ($user->getGrade()->getType() == GRADE_TYPE_ADMIN)
				echo '<a class="active" href="'.$url.'/bdbdec.php?action=editUserAdmin">Modifier un utilisateur</a>';
			echo '   
			</li>
		</ul>
	</div>
	<form action="./bdbdec.php" method="get">
		<fieldset class="collapsible">
			<legend><a href="#">Entrez le nom de l\'utilisateur</a></legend>
			<input type="hidden" name="action" value="'.$action.'" />
			<input id="username" class="inputName large" type="text" /><br /><br />
			<input id="userId" type="hidden" name="id" value="0" />
			<input class="validName" type="submit">
		</fieldset>
	</form>';
	
?>